#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

int romanToInt(char* s);

int main()
{
	return 0;
}

int romanToInt(char* s)
{
	int symbol2val[26] = { ['I' - 'A'] = 1, ['V' - 'A'] = 5, ['X' - 'A'] = 10, ['L' - 'A'] = 50,
		['C' - 'A'] = 100, ['D' - 'A'] = 500, ['M' - 'A'] = 1000 };
	int ans = 0;
	for (int i = 0; s[i]; ++i) {
		int value = symbol2val[s[i] - 'A'];
		if (s[i + 1] && value < symbol2val[s[i + 1] - 'A'])
			ans -= value;
		else
			ans += value;
	}
	return ans;
}
